import os.path
from flask import Flask
from flask import send_from_directory

app = Flask(__name__)
app.dict_age = {"brt": 29, "tmv": 1}

dir_html = os.path.join(os.path.dirname(os.path.abspath(__file__)), "html")

@app.route("/pong")
def pong():
    app.dict_age["tmv"] += 1
    return f"Hello: {app.dict_age}"

@app.route("/user/<string:name>", methods=["GET", "POST"])
def user(name):
    print("-->", name)
    if not name:
        return f"{app.dict_age.keys()}"
    else:
        age = app.dict_age[name]
        return f"The age: {age}"

@app.route("/")
def index():
    return send_from_directory(dir_html, "vue.html")

if __name__ == "__main__":
    # app.debug = True
    app.run(port=9999, debug=True)